<%@page contentType="text/html;charset=utf-8" %>
<%@page import="java.sql.*" %>
<%@page import="javax.sql.*" %>
<%@page import="javax.naming.*" %>
<html>
<head>
<title>Tomcat连接池测试</title>
</head>
<body>
<%
  Context ctx=new InitialContext();
  Connection conn=null;
  DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/app");
  conn=ds.getConnection();
  Statement stmt=conn.createStatement(ResultSet.CONCUR_READ_ONLY,ResultSet.CONCUR_UPDATABLE);
  ResultSet rs=stmt.executeQuery("select * from users");
  while(rs.next()){
  out.println(rs.getInt(1));
  out.println(rs.getString(2));
  out.println(rs.getString(3));
  }
  out.println("数据库操作成功！");
  rs.close();
  stmt.close();
  conn.close();
   
 %>
</body>
</html>